import { RouterName } from '../name'
import { mergeMeta } from '../merge-meta'
import { Role } from '@/constants/role'

export const postRoutes = mergeMeta(
  [
    {
      path: '/posts',
      name: RouterName.Post,
      meta: { order: -10 },
      component: () => import('@/layouts/MarkdownPreview.vue'),
      children: [
        {
          path: 'help',
          name: RouterName.Help,
          meta: {
            order: -10,
            menuTitle: 'navigation.help.title',
            hideInMenu: false,
            isLink: false,
            icon: 'i-fluent-notebook-question-mark-20-filled'
          },
          children: [
            {
              path: 'changelog',
              name: RouterName.Changelog,
              meta: {
                menuTitle: 'navigation.help.changelog',
                icon: 'i-fluent-document-text-clock-24-filled'
              },
              component: () => import('@/posts/changelog.md')
            },
            {
              path: 'platform',
              name: RouterName.PlatformHelp,
              meta: {
                menuTitle: 'navigation.help.platform',
                icon: 'i-fluent-phone-laptop-16-filled'
              },
              component: () => import('@/posts/platform.md')
            },
            {
              path: 'markdown',
              name: RouterName.MarkdownHelp,
              meta: {
                role: Role.Teacher | Role.Admin,
                menuTitle: 'navigation.help.markdown',
                icon: 'i-mdi-language-markdown'
              },
              component: () => import('@/posts/markdown.md')
            }
          ]
        }
      ]
    }
  ],
  {
    requireAuth: true,
    role: Role.All,
    hideInMenu: true
  }
)
